import { defineMock } from "./base";

export default defineMock([
  {
    url: "users/me",
    method: ["GET"],
    body: {
      code: "00000",
      data: {
        userId: 2,
        username: "admin",
        nickname: "系统管理员",
        avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
        roles: ["ADMIN"],
        perms: [
          "sys:notice:edit",
          "sys:menu:delete",
          "sys:dict:edit",
          "sys:notice:query",
          "sys:dict:delete",
          "sys:config:add",
          "sys:config:refresh",
          "sys:menu:add",
          "sys:user:add",
          "sys:user:export",
          "sys:role:edit",
          "sys:dept:delete",
          "sys:config:update",
          "sys:user:password:reset",
          "sys:notice:revoke",
          "sys:user:import",
          "sys:user:delete",
          "sys:dict_type:delete",
          "sys:dict:add",
          "sys:role:add",
          "sys:notice:publish",
          "sys:notice:delete",
          "sys:dept:edit",
          "sys:dict_type:edit",
          "sys:user:query",
          "sys:user:edit",
          "sys:config:delete",
          "sys:dept:add",
          "sys:notice:add",
          "sys:role:delete",
          "sys:menu:edit",
          "sys:config:query",
        ],
      },
      msg: "一切ok",
    },
  },

  {
    url: "users/page",
    method: ["GET"],
    body: {
      code: "00000",
      data: {
        list: [
          {
            id: 1,
            orderNum: "201201010001",
            orderType: "0",
            curNum: "C20241117001",
            curName: "珠海市XXXXX公司",
            affContract: "CTR20240101001",
            salesPerson: "00001-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-01",
            remake: "备注",
            appRemake: "备注",
            status: 1,
            rowList: [
              {
                productType: "蔬菜类",
                productNum: "SC00001",
                productName: "胡萝卜丝",
                num: "10",
              },
              {
                productType: "肉类",
                productNum: "MT00001",
                productName: "牛肉",
                num: "15",
              },
              {
                productType: "鱼类类",
                productNum: "YL00001",
                productName: "鱼肉",
                num: "15",
              },
              {
                productType: "蔬菜类",
                productNum: "SC00001",
                productName: "胡萝卜丝",
                num: "10",
              },
              {
                productType: "肉类",
                productNum: "MT00001",
                productName: "牛肉",
                num: "15",
              },
              {
                productType: "鱼类类",
                productNum: "YL00001",
                productName: "鱼肉",
                num: "15",
              },
              {
                productType: "蔬菜类",
                productNum: "SC00001",
                productName: "胡萝卜丝",
                num: "10",
              },
              {
                productType: "肉类",
                productNum: "MT00001",
                productName: "牛肉",
                num: "15",
              },
              {
                productType: "鱼类类",
                productNum: "YL00001",
                productName: "鱼肉",
                num: "15",
              },
            ],
          },
          {
            id: 2,
            orderNum: "201201010002",
            orderType: "1",
            curNum: "C20241117002",
            curName: "中国XXXXX公司",
            affContract: "CTR20240101002",
            salesPerson: "00002-李四",
            updatedBy: "wangwu",
            updatedTime: "2012-01-02",
            remake: "备注",
            appRemake: "备注",
            status: 0,
            rowList: [
              {
                productType: "蔬菜类2",
                productNum: "SC00002",
                productName: "胡萝卜2",
                num: "12",
              },
              {
                productType: "肉类2",
                productNum: "MT00002",
                productName: "牛肉2",
                num: "12",
              },
              {
                productType: "鱼类类2",
                productNum: "YL00002",
                productName: "鱼肉2",
                num: "12",
              },
              {
                productType: "蔬菜类2",
                productNum: "SC00002",
                productName: "胡萝卜丝2",
                num: "12",
              },
              {
                productType: "肉类2",
                productNum: "MT00002",
                productName: "牛肉2",
                num: "15",
              },
              {
                productType: "鱼类类2",
                productNum: "YL00002",
                productName: "鱼肉2",
                num: "15",
              },
              {
                productType: "蔬菜类2",
                productNum: "SC00002",
                productName: "胡萝卜丝2",
                num: "10",
              },
              {
                productType: "肉类2",
                productNum: "MT00002",
                productName: "牛肉2",
                num: "15",
              },
              {
                productType: "鱼类类2",
                productNum: "YL00002",
                productName: "鱼肉2",
                num: "15",
              },
            ],
          },
          {
            id: 3,
            orderNum: "201201010003",
            orderType: "2",
            curNum: "C20241117003",
            curName: "电商C端客户",
            affContract: "CTR20240101003",
            salesPerson: "00003-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-03",
            remake: "备注",
            appRemake: "备注",
            status: 1,
            rowList: [
              {
                productType: "蔬菜类3",
                productNum: "SC00003",
                productName: "胡萝卜丝3",
                num: "10",
              },
              {
                productType: "肉类3",
                productNum: "MT00003",
                productName: "牛肉3",
                num: "15",
              },
              {
                productType: "鱼类类3",
                productNum: "YL00003",
                productName: "鱼肉3",
                num: "15",
              },
              {
                productType: "蔬菜类3",
                productNum: "SC000013",
                productName: "胡萝卜丝3",
                num: "10",
              },
              {
                productType: "肉类3",
                productNum: "MT000013",
                productName: "牛肉3",
                num: "15",
              },
              {
                productType: "鱼类类3",
                productNum: "YL000013",
                productName: "鱼肉3",
                num: "15",
              },
              {
                productType: "蔬菜类3",
                productNum: "SC000013",
                productName: "胡萝卜丝3",
                num: "10",
              },
              {
                productType: "肉类3",
                productNum: "MT000013",
                productName: "牛肉3",
                num: "15",
              },
              {
                productType: "鱼类类3",
                productNum: "YL000013",
                productName: "鱼肉3",
                num: "15",
              },
            ],
          },
          {
            id: 4,
            orderNum: "201201010004",
            orderType: "0",
            curNum: "C20241117004",
            curName: "珠海市XXXXX公司",
            affContract: "CTR20240101004",
            salesPerson: "00004-李四",
            updatedBy: "wangwu",
            updatedTime: "2012-01-04",
            remake: "备注",
            appRemake: "备注",
            status: 0,
            rowList: [
              {
                productType: "蔬菜类4",
                productNum: "SC000014",
                productName: "胡萝卜丝4",
                num: "10",
              },
              {
                productType: "肉类4",
                productNum: "MT000014",
                productName: "牛肉4",
                num: "15",
              },
              {
                productType: "鱼类类4",
                productNum: "YL000014",
                productName: "鱼肉4",
                num: "15",
              },
              {
                productType: "蔬菜类4",
                productNum: "SC000014",
                productName: "胡萝卜丝4",
                num: "10",
              },
              {
                productType: "肉类4",
                productNum: "MT000014",
                productName: "牛肉4",
                num: "15",
              },
              {
                productType: "鱼类类4",
                productNum: "YL000014",
                productName: "鱼肉4",
                num: "15",
              },
              {
                productType: "蔬菜类4",
                productNum: "SC000014",
                productName: "胡萝卜丝4",
                num: "10",
              },
              {
                productType: "肉类4",
                productNum: "MT000014",
                productName: "牛肉4",
                num: "15",
              },
              {
                productType: "鱼类类4",
                productNum: "YL000014",
                productName: "鱼肉4",
                num: "15",
              },
            ],
          },
          {
            id: 5,
            orderNum: "201201010005",
            orderType: "1",
            curNum: "C20241117005",
            curName: "中国XXXXX公司",
            affContract: "CTR20240101005",
            salesPerson: "00005-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-05",
            remake: "备注",
            appRemake: "备注",
            status: 1,
            rowList: [
              {
                productType: "蔬菜类5",
                productNum: "SC000015",
                productName: "胡萝卜丝5",
                num: "10",
              },
              {
                productType: "肉类5",
                productNum: "MT000015",
                productName: "牛肉5",
                num: "15",
              },
              {
                productType: "鱼类类5",
                productNum: "YL000015",
                productName: "鱼肉5",
                num: "15",
              },
              {
                productType: "蔬菜类5",
                productNum: "SC000015",
                productName: "胡萝卜丝5",
                num: "10",
              },
              {
                productType: "肉类5",
                productNum: "MT000015",
                productName: "牛肉5",
                num: "15",
              },
              {
                productType: "鱼类类5",
                productNum: "YL000015",
                productName: "鱼肉5",
                num: "15",
              },
              {
                productType: "蔬菜类5",
                productNum: "SC000015",
                productName: "胡萝卜丝5",
                num: "10",
              },
              {
                productType: "肉类5",
                productNum: "MT000015",
                productName: "牛肉5",
                num: "15",
              },
              {
                productType: "鱼类类5",
                productNum: "YL000015",
                productName: "鱼肉5",
                num: "15",
              },
            ],
          },
          {
            id: 6,
            orderNum: "201201010006",
            orderType: "2",
            curNum: "C20241117006",
            curName: "珠海市XXXXX公司",
            affContract: "CTR20240101006",
            salesPerson: "00006-李四",
            updatedBy: "wangwu",
            updatedTime: "2012-01-06",
            remake: "备注",
            appRemake: "备注",
            status: 0,
            rowList: [
              {
                productType: "蔬菜类6",
                productNum: "SC000016",
                productName: "胡萝卜丝6",
                num: "10",
              },
              {
                productType: "肉类6",
                productNum: "MT000016",
                productName: "牛肉6",
                num: "15",
              },
              {
                productType: "鱼类类6",
                productNum: "YL000016",
                productName: "鱼肉6",
                num: "15",
              },
              {
                productType: "蔬菜类6",
                productNum: "SC000016",
                productName: "胡萝卜丝6",
                num: "10",
              },
              {
                productType: "肉类6",
                productNum: "MT000016",
                productName: "牛肉6",
                num: "15",
              },
              {
                productType: "鱼类类6",
                productNum: "YL000016",
                productName: "鱼肉6",
                num: "15",
              },
              {
                productType: "蔬菜类6",
                productNum: "SC000016",
                productName: "胡萝卜丝6",
                num: "10",
              },
              {
                productType: "肉类6",
                productNum: "MT000016",
                productName: "牛肉6",
                num: "15",
              },
              {
                productType: "鱼类类6",
                productNum: "YL000016",
                productName: "鱼肉6",
                num: "15",
              },
            ],
          },
          {
            id: 7,
            orderNum: "201201010007",
            orderType: "0",
            curNum: "C20241117007",
            curName: "中国XXXXX公司",
            affContract: "CTR20240101007",
            salesPerson: "00007-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-07",
            remake: "备注",
            appRemake: "备注",
            status: 1,
            rowList: [
              {
                productType: "蔬菜类7",
                productNum: "SC000017",
                productName: "胡萝卜丝7",
                num: "10",
              },
              {
                productType: "肉类7",
                productNum: "MT000017",
                productName: "牛肉7",
                num: "15",
              },
              {
                productType: "鱼类类7",
                productNum: "YL000017",
                productName: "鱼肉7",
                num: "15",
              },
              {
                productType: "蔬菜类7",
                productNum: "SC000017",
                productName: "胡萝卜丝7",
                num: "10",
              },
              {
                productType: "肉类7",
                productNum: "MT000017",
                productName: "牛肉7",
                num: "15",
              },
              {
                productType: "鱼类类7",
                productNum: "YL000017",
                productName: "鱼肉7",
                num: "15",
              },
              {
                productType: "蔬菜类7",
                productNum: "SC000017",
                productName: "胡萝卜丝7",
                num: "10",
              },
              {
                productType: "肉类7",
                productNum: "MT000017",
                productName: "牛肉7",
                num: "15",
              },
              {
                productType: "鱼类类7",
                productNum: "YL000017",
                productName: "鱼肉7",
                num: "15",
              },
            ],
          },
          {
            id: 8,
            orderNum: "201201010008",
            orderType: "1",
            curNum: "C20241117008",
            curName: "珠海市XXXXX公司",
            affContract: "CTR20240101008",
            salesPerson: "00008-李四",
            updatedBy: "wangwu",
            updatedTime: "2012-01-08",
            remake: "备注",
            appRemake: "备注",
            status: 4,
            rowList: [
              {
                productType: "蔬菜类8",
                productNum: "SC000018",
                productName: "胡萝卜丝8",
                num: "10",
              },
              {
                productType: "肉类8",
                productNum: "MT000018",
                productName: "牛肉8",
                num: "15",
              },
              {
                productType: "鱼类类8",
                productNum: "YL000018",
                productName: "鱼肉8",
                num: "15",
              },
              {
                productType: "蔬菜类8",
                productNum: "SC000018",
                productName: "胡萝卜丝8",
                num: "10",
              },
              {
                productType: "肉类8",
                productNum: "MT000018",
                productName: "牛肉8",
                num: "15",
              },
              {
                productType: "鱼类类8",
                productNum: "YL000018",
                productName: "鱼肉8",
                num: "15",
              },
              {
                productType: "蔬菜类8",
                productNum: "SC000018",
                productName: "胡萝卜丝8",
                num: "10",
              },
              {
                productType: "肉类8",
                productNum: "MT000018",
                productName: "牛肉8",
                num: "15",
              },
              {
                productType: "鱼类类8",
                productNum: "YL000018",
                productName: "鱼肉8",
                num: "15",
              },
            ],
          },
          {
            id: 9,
            orderNum: "201201010009",
            orderType: "2",
            curNum: "C20241117009",
            curName: "中国XXXXX公司",
            affContract: "CTR20240101009",
            salesPerson: "00009-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-09",
            remake: "备注",
            appRemake: "备注",
            status: 5,
            rowList: [
              {
                productType: "蔬菜类9",
                productNum: "SC000019",
                productName: "胡萝卜丝9",
                num: "10",
              },
              {
                productType: "肉类9",
                productNum: "MT000019",
                productName: "牛肉9",
                num: "15",
              },
              {
                productType: "鱼类类9",
                productNum: "YL000019",
                productName: "鱼肉9",
                num: "15",
              },
              {
                productType: "蔬菜类9",
                productNum: "SC000019",
                productName: "胡萝卜丝9",
                num: "10",
              },
              {
                productType: "肉类9",
                productNum: "MT000019",
                productName: "牛肉9",
                num: "15",
              },
              {
                productType: "鱼类类9",
                productNum: "YL000019",
                productName: "鱼肉9",
                num: "15",
              },
              {
                productType: "蔬菜类9",
                productNum: "SC000019",
                productName: "胡萝卜丝9",
                num: "10",
              },
              {
                productType: "肉类9",
                productNum: "MT000019",
                productName: "牛肉9",
                num: "15",
              },
              {
                productType: "鱼类类9",
                productNum: "YL000019",
                productName: "鱼肉9",
                num: "15",
              },
            ],
          },
          {
            id: 10,
            orderNum: "201201010010",
            orderType: "0",
            curNum: "C20241117010",
            curName: "珠海市XXXXX公司",
            affContract: "CTR20240101010",
            salesPerson: "00010-李四",
            updatedBy: "wangwu",
            updatedTime: "2012-01-10",
            remake: "备注",
            appRemake: "备注",
            status: 0,
            rowList: [
              {
                productType: "蔬菜类00",
                productNum: "SC0000100",
                productName: "胡萝卜丝00",
                num: "10",
              },
              {
                productType: "肉类00",
                productNum: "MT0000100",
                productName: "牛肉00",
                num: "15",
              },
              {
                productType: "鱼类类00",
                productNum: "YL0000100",
                productName: "鱼肉00",
                num: "15",
              },
              {
                productType: "蔬菜类00",
                productNum: "SC0000100",
                productName: "胡萝卜丝00",
                num: "10",
              },
              {
                productType: "肉类00",
                productNum: "MT0000100",
                productName: "牛肉00",
                num: "15",
              },
              {
                productType: "鱼类类00",
                productNum: "YL0000100",
                productName: "鱼肉00",
                num: "15",
              },
              {
                productType: "蔬菜类00",
                productNum: "SC0000100",
                productName: "胡萝卜丝00",
                num: "10",
              },
              {
                productType: "肉类00",
                productNum: "MT0000100",
                productName: "牛肉00",
                num: "15",
              },
              {
                productType: "鱼类类00",
                productNum: "YL0000100",
                productName: "鱼肉00",
                num: "15",
              },
            ],
          },
          {
            id: 11,
            orderNum: "201201010011",
            orderType: "1",
            curNum: "C20241117011",
            curName: "中国XXXXX公司",
            affContract: "CTR20240101011",
            salesPerson: "00011-张三",
            updatedBy: "wangwu",
            updatedTime: "2012-01-11",
            remake: "备注",
            appRemake: "备注",
            status: 6,
            rowList: [
              {
                productType: "蔬菜类11",
                productNum: "SC0000111",
                productName: "胡萝卜丝11",
                num: "10",
              },
              {
                productType: "肉类11",
                productNum: "MT0000111",
                productName: "牛肉11",
                num: "15",
              },
              {
                productType: "鱼类类11",
                productNum: "YL0000111",
                productName: "鱼肉11",
                num: "15",
              },
              {
                productType: "蔬菜类11",
                productNum: "SC0000111",
                productName: "胡萝卜丝11",
                num: "10",
              },
              {
                productType: "肉类11",
                productNum: "MT0000111",
                productName: "牛肉11",
                num: "15",
              },
              {
                productType: "鱼类类11",
                productNum: "YL0000111",
                productName: "鱼肉11",
                num: "15",
              },
              {
                productType: "蔬菜类11",
                productNum: "SC0000111",
                productName: "胡萝卜丝11",
                num: "10",
              },
              {
                productType: "肉类11",
                productNum: "MT0000111",
                productName: "牛肉11",
                num: "15",
              },
              {
                productType: "鱼类类11",
                productNum: "YL0000111",
                productName: "鱼肉11",
                num: "15",
              },
            ],
          },
        ],
        total: 2,
      },
      msg: "一切ok",
    },
  },

  // 新增用户
  {
    url: "users",
    method: ["POST"],
    body({ body }) {
      return {
        code: "00000",
        data: null,
        msg: "新增用户" + body.nickname + "成功",
      };
    },
  },

  // 获取用户表单数据
  {
    url: "users/:userId/form",
    method: ["GET"],
    body: ({ params }) => {
      return {
        code: "00000",
        data: userMap[params.userId],
        msg: "一切ok",
      };
    },
  },
  // 修改用户
  {
    url: "users/:userId",
    method: ["PUT"],
    body({ body }) {
      return {
        code: "00000",
        data: null,
        msg: "修改用户" + body.nickname + "成功",
      };
    },
  },

  // 删除用户
  {
    url: "users/:userId",
    method: ["DELETE"],
    body({ params }) {
      return {
        code: "00000",
        data: null,
        msg: "删除用户" + params.id + "成功",
      };
    },
  },

  // 重置密码
  {
    url: "users/:userId/password/reset",
    method: ["PUT"],
    body({ query }) {
      return {
        code: "00000",
        data: null,
        msg: "重置密码成功，新密码为：" + query.password,
      };
    },
  },

  // 导出Excel
  {
    url: "users/_export",
    method: ["GET"],
    headers: {
      "Content-Disposition": "attachment; filename=%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8.xlsx",
      "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    },
  },

  {
    url: "users/profile",
    method: ["GET"],
    body: {
      code: "00000",
      data: {
        id: 2,
        username: "admin",
        nickname: "系统管理员",
        avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
        gender: 1,
        mobile: "17621210366",
        email: null,
        deptName: "有来技术",
        roleNames: "系统管理员",
        createTime: "2019-10-10",
      },
    },
  },

  {
    url: "users/profile",
    method: ["PUT"],
    body({ query } /* eslint-disable-line @typescript-eslint/no-unused-vars */) {
      return {
        code: "00000",
        data: null,
        msg: "修改个人信息成功",
      };
    },
  },

  {
    url: "users/password",
    method: ["PUT"],
    body({ query } /* eslint-disable-line @typescript-eslint/no-unused-vars */) {
      return {
        code: "00000",
        data: null,
        msg: "修改密码成功",
      };
    },
  },
]);

// 用户映射表数据
const userMap: Record<string, any> = {
  2: {
    id: 2,
    username: "admin",
    nickname: "系统管理员",
    mobile: "17621210366",
    gender: 1,
    avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
    email: "",
    status: 1,
    deptId: 1,
    roleIds: [2],
  },
  3: {
    id: 3,
    username: "test",
    nickname: "测试小用户",
    mobile: "17621210366",
    gender: 1,
    avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
    email: "youlaitech@163.com",
    status: 1,
    deptId: 3,
    roleIds: [3],
  },
};
